(0) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

f(c(a, z, x)) → b(a, z)
b(x, b(z, y)) → f(b(f(f(z)), c(x, z, y)))
b(y, z) → z

Rewrite Strategy: INNERMOST

(1) NestedDefinedSymbolProof (BOTH BOUNDS(ID, ID) transformation)

The TRS does not nest defined symbols.
Hence, the left-hand sides of the following rules are not basic-reachable and can be removed:
b(x, b(z, y)) → f(b(f(f(z)), c(x, z, y)))

(2) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

b(y, z) → z
f(c(a, z, x)) → b(a, z)

Rewrite Strategy: INNERMOST

(3) TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID) transformation)

Transformed TRS to weighted TRS

(4) Obligation:

The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

b(y, z) → z [1]
f(c(a, z, x)) → b(a, z) [1]

Rewrite Strategy: INNERMOST

(5) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)

Infered types.

(6) Obligation:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

b(y, z) → z [1]
f(c(a, z, x)) → b(a, z) [1]

The TRS has the following type information:
b :: a → b:f → b:f
f :: c → b:f
c :: a → b:f → b → c
a :: a

Rewrite Strategy: INNERMOST

(7) CompletionProof (UPPER BOUND(ID) transformation)

The TRS is a completely defined constructor system, as every type has a constant constructor and the following rules were added:

f(v0) → null_f [0]

And the following fresh constants:

null_f, const, const1

(8) Obligation:

Runtime Complexity Weighted TRS where all functions are completely defined. The underlying TRS is:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

b(y, z) → z [1]
f(c(a, z, x)) → b(a, z) [1]
f(v0) → null_f [0]

The TRS has the following type information:
b :: a → null_f → null_f
f :: c → null_f
c :: a → null_f → b → c
a :: a
null_f :: null_f
const :: c
const1 :: b

Rewrite Strategy: INNERMOST

(9) CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID) transformation)

Transformed the TRS into an over-approximating RNTS by (improved) Size Abstraction.
The constant constructors are abstracted as follows:

a => 0
null_f => 0
const => 0
const1 => 0

(10) Obligation:

Complexity RNTS consisting of the following rules:

b(z', z'') -{ 1 }→ z :|: z'' = z, z >= 0, y >= 0, z' = y
f(z') -{ 1 }→ b(0, z) :|: z >= 0, x >= 0, z' = 1 + 0 + z + x
f(z') -{ 0 }→ 0 :|: v0 >= 0, z' = v0

Only complete derivations are relevant for the runtime complexity.

(11) CompleteCoflocoProof (EQUIVALENT transformation)

Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo:

eq(start(V, V1),0,[b(V, V1, Out)],[V >= 0,V1 >= 0]).
eq(start(V, V1),0,[f(V, Out)],[V >= 0]).
eq(b(V, V1, Out),1,[],[Out = V2,V1 = V2,V2 >= 0,V3 >= 0,V = V3]).
eq(f(V, Out),1,[b(0, V4, Ret)],[Out = Ret,V4 >= 0,V5 >= 0,V = 1 + V4 + V5]).
eq(f(V, Out),0,[],[Out = 0,V6 >= 0,V = V6]).
input_output_vars(b(V,V1,Out),[V,V1],[Out]).
input_output_vars(f(V,Out),[V],[Out]).

CoFloCo proof output:
Preprocessing Cost Relations
=====================================

#### Computed strongly connected components
0. non_recursive : [b/3]
1. non_recursive : [f/2]
2. non_recursive : [start/2]

#### Obtained direct recursion through partial evaluation
0. SCC is completely evaluated into other SCCs
1. SCC is partially evaluated into f/2
2. SCC is partially evaluated into start/2

Control-Flow Refinement of Cost Relations
=====================================

### Specialization of cost equations f/2
* CE 4 is refined into CE [6]
* CE 5 is refined into CE [7]


### Cost equations --> "Loop" of f/2
* CEs [6] --> Loop 4
* CEs [7] --> Loop 5

### Ranking functions of CR f(V,Out)

#### Partial ranking functions of CR f(V,Out)


### Specialization of cost equations start/2
* CE 2 is refined into CE [8]
* CE 3 is refined into CE [9,10]


### Cost equations --> "Loop" of start/2
* CEs [8,9,10] --> Loop 6

### Ranking functions of CR start(V,V1)

#### Partial ranking functions of CR start(V,V1)


Computing Bounds
=====================================

#### Cost of chains of f(V,Out):
* Chain [5]: 0
with precondition: [Out=0,V>=0]

* Chain [4]: 2
with precondition: [Out>=0,V>=Out+1]


#### Cost of chains of start(V,V1):
* Chain [6]: 2
with precondition: [V>=0]


Closed-form bounds of start(V,V1):
-------------------------------------
* Chain [6] with precondition: [V>=0]
- Upper bound: 2
- Complexity: constant

### Maximum cost of start(V,V1): 2
Asymptotic class: constant
* Total analysis performed in 24 ms.

(12) BOUNDS(1, 1)